function getValue(elem) {
        elem.children("div").children("p.alert-danger").text("");
        if (elem.find("li.active").length === 0) {
            return false;
        }
        else {
            return elem.find("li.active").children("input").val();
        }
    }
$(document).ready(function(){
     $("ul.dropdown-menu").children("li").click(function() {
        $(this).parents("ul").children("li").removeClass("active");
        $(this).addClass("active");
        $(this).parent("ul").prev("button").html($(this).html() + "<span class=\"caret\">");
        $(this).parent("ul").parent("div").next("p").text("");
    });
    $(".submitPayment").click(function() {
        var td= $(this).parent().parent().children("td");
        var id = $(this).parent().parent().children("input[name=ProductID]").val();
        var name = td.children("input[name=ProductName]").val();
        var amount = td.children("input[name=Amount]").val();
         var price = td.children("input[name=GrossPrice]").val();
        var active = getValue(td.children("#Active"));
        var vat = getValue(td.children("#vatSelect"));
        var manufacturer = getValue(td.children("#manufacturers"));
        var category = getValue(td.children("#categories"));
       
        var shopname = $("#shopname").val();
        var url = "/" + shopname + "/ShopAdmin_Products/fastedit";
        console.log(vat);
        $.post(url,
                {
                    id:id,
                    name:name,
                    amount:amount,
                    price:price,
                    active:active,
                    vat: vat,
                    manufacturer:manufacturer,
                    category:category

                }).done(function(evt) {
                   // console.log(evt);
          window.location.href = window.location.href;
        });
    });
});

